<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="utf-8" />
        <title>TextLine - ESUI Demo</title>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="assets/google-code-prettify/prettify.css" />
        <link rel="stylesheet" href="assets/themes/standard.css" />
        <!--[if lt IE 9]>
        <link rel="stylesheet" href="assets/ie8.css" />
        <![endif]-->
    </head>
<body>
    <div class="header">
        <h1 id="branding">ESUI - TextLine</h1>
    </div>
    <div class="ui-g main-container">
        <div id="side-bar" class="ui-u-1-5">
            <ul id="navigator" class="ui-nav">
            </ul>
        </div>
        <div id="main" class="ui-u-4-5">
            <h2>搜索</h2>
            <p></p>
            <div class="example">
                <h3>search</h3>
                <div class="row">
                    <div data-ui-type="SearchBox" data-ui-id="normal-search" data-ui-width="302" data-ui-button-position="right" ></div>
                </div>
                <textarea data-ui="id:searchTextLine;type:TextLine;name:textLine;"></textarea>
            </div>

            <h2>从TextArea初始化</h2>
            <p>描述</p>
            <div class="example">
                <textarea data-ui="type:TextLine;">line1
test2
tst3</textarea>
            </div>

            <h2>状态</h2>
            <p>描述</p>
            <div class="example">
                <h3>Error</h3>
                <div data-ui="type:TextLine;name:textLine;id:errorTextLine">
                </div>
                <h3>Disabled</h3>
                <div data-ui="type:TextLine;name:textLine;disabled:disabled;rawValue:disabled"></div>
                <h3>Read Only</h3>
                <div data-ui="type:TextLine;name:textLine;readOnly:readOnly;rawValue:readOnly"></div>
                <h3>Success</h3>
                <div data-ui="type:TextLine;name:textLine;rawValue:success;states:success"></div>
                <h3>Warning</h3>
                <div data-ui="type:TextLine;name:textLine;rawValue:warning;states:warning"></div>
            </div>

            <h2>PlaceHolder</h2>
            <p>描述</p>
            <div class="example">
                <div data-ui="type:TextLine;name:textLine;placeholder:warning;"></div>
            </div>
        </div>
    </div>
    <script src="assets/loader/esl.js"></script>
    <script src="config.js"></script>
    <script src="demo.js"></script>
    <script src="assets/google-code-prettify/prettify.js"></script>
    <script id="main-js">
    require(
        [
            'esui',
            'esui/TextLine',
            'esui/Tab',
            'esui/SearchBox',
            'demo'
        ],
        function (ui) {
            var controls = ui.init();
            var search = ui.get('normal-search');
            var line = ui.get('searchTextLine');

            search.on('search', function (e) {
                var value = e.target.getValue();
                var re = value ? new RegExp('^' + value) : '';
                line.setProperties({
                    query: re
                });
            });

            line.setProperties({
                rawValue: [
                    '你好',
                    '世界',
                    'Hello',
                    'World',
                    'Bonjour'
                ]
            });

            var error = ui.get('errorTextLine');
            error.showValidationMessage('invalid', '错误信息！');
        }
    );
    </script>
    <script src="sitemap.js"></script>
</body>
</html>
